<?php

function blg_menu_init(){
	global $_MENU;
	
	/****************************************************************/
	
	$root= new BlgMenuItem(array(
		'name' => 'root',
		'href' => blg_get_site_url(),
		'text' => blg_get_config('site_title'),
		//'priority' => '10',		
		//'is_action' => false,
		//'selected' => false,
		//'enabled' => true,
		'visible' => FALSE,
		//'parent' => null,
		//'class' => 'myclass'
	));

	/****************************************************************/
	
	$commerce= new BlgMenuItem(array(
		'name' => 'commerce',
		'href' => blg_get_site_url(),
		'text' => 'Tu red Comercial',
		'priority' => '10',		
		//'is_action' => false,
		//'selected' => false,
		//'enabled' => true,
		//'visible' => TRUE,
		//'parent' => null,
		//'class' => 'myclass'
	));	
	
	$social= new BlgMenuItem(array(
		'name' => 'social',
		'href' => blg_get_site_url(),
		'text' => 'Tu red Social',
		'priority' => '20',		
		//'is_action' => false,
		//'selected' => false,
		//'enabled' => true,
		//'visible' => TRUE,
		//'parent' => null,
		//'class' => 'myclass'
	));

	$job= new BlgMenuItem(array(
		'name' => 'job',
		'href' => blg_get_site_url(),
		'text' => 'Empleo',
		'priority' => '30',		
		//'is_action' => false,
		//'selected' => false,
		//'enabled' => true,
		//'visible' => TRUE,
		//'parent' => null,
		//'class' => 'myclass'
	));		
	
	$config= new BlgMenuItem(array(
		'name' => 'config',
		'href' => blg_get_site_url(),
		'text' => 'Configuración',
		'priority' => '40',		
		//'is_action' => false,
		//'selected' => false,
		//'enabled' => true,
		'visible' => FALSE,
		//'parent' => null,
		//'class' => 'myclass'
	));		
	
	/****************************************************************/
	
	$commerce_home= new BlgMenuItem(array(
		'name' => 'commerce_home',
		'href' => blg_get_site_url(),
		'text' => 'Hogar',
		'priority' => '10',		
		//'is_action' => false,
		//'selected' => false,
		//'enabled' => true,
		//'visible' => TRUE,
		//'parent' => null,
		//'class' => 'myclass'
	));	

	$commerce_fashion= new BlgMenuItem(array(
		'name' => 'commerce_fashion',
		'href' => blg_get_site_url(),
		'text' => 'Moda y accesorios',
		'priority' => '20',		
		//'is_action' => false,
		//'selected' => false,
		//'enabled' => true,
		//'visible' => TRUE,
		//'parent' => null,
		//'class' => 'myclass'
	));	

	$commerce_computer= new BlgMenuItem(array(
		'name' => 'commerce_computer',
		'href' => blg_get_site_url(),
		'text' => 'Informatica y electrónica',
		'priority' => '30',		
		//'is_action' => false,
		//'selected' => false,
		//'enabled' => true,
		//'visible' => TRUE,
		//'parent' => null,
		//'class' => 'myclass'
	));	
	
	$commerce_motor= new BlgMenuItem(array(
		'name' => 'commerce_motor',
		'href' => blg_get_site_url(),
		'text' => 'Motor',
		'priority' => '40',		
		//'is_action' => false,
		//'selected' => false,
		//'enabled' => true,
		//'visible' => TRUE,
		//'parent' => null,
		//'class' => 'myclass'
	));		
	
	/****************************************************************/	
	
	$commerce_computer_accesories= new BlgMenuItem(array(
		'name' => 'commerce_computer_accesories',
		'href' => blg_get_site_url(),
		'text' => 'Accesorios',
		'priority' => '10',		
		//'is_action' => false,
		//'selected' => false,
		//'enabled' => true,
		//'visible' => TRUE,
		//'parent' => null,
		//'class' => 'myclass'
	));	
	
	$commerce_computer_storage= new BlgMenuItem(array(
		'name' => 'commerce_computer_storage',
		'href' => blg_get_site_url(),
		'text' => 'Storage',
		'priority' => '20',		
		//'is_action' => false,
		//'selected' => false,
		//'enabled' => true,
		//'visible' => TRUE,
		//'parent' => null,
		//'class' => 'myclass'
	));

	$commerce_computer_comunications= new BlgMenuItem(array(
		'name' => 'commerce_computer_comunications',
		'href' => blg_get_site_url(),
		'text' => 'Comunicaciones',
		'priority' => '30',		
		//'is_action' => false,
		//'selected' => false,
		//'enabled' => true,
		//'visible' => TRUE,
		//'parent' => null,
		//'class' => 'myclass'
	));		
	
	$commerce_computer_ebooks= new BlgMenuItem(array(
		'name' => 'commerce_computer_ebooks',
		'href' => blg_get_site_url(),
		'text' => 'Ebooks',
		'priority' => '40',		
		//'is_action' => false,
		//'selected' => false,
		//'enabled' => true,
		//'visible' => TRUE,
		//'parent' => null,
		//'class' => 'myclass'
	));		

	/****************************************************************/
	
	$commerce_computer->register_child($commerce_computer_accesories);
	$commerce_computer->register_child($commerce_computer_storage);
	$commerce_computer->register_child($commerce_computer_comunications);
	$commerce_computer->register_child($commerce_computer_ebooks);
	
	/****************************************************************/
	
	$commerce->register_child($commerce_home);
	$commerce->register_child($commerce_fashion);
	$commerce->register_child($commerce_computer);
	$commerce->register_child($commerce_motor);
	
	/****************************************************************/
	
	$root->register_child($commerce);
	$root->register_child($social);
	$root->register_child($job);
	$root->register_child($config);
	
	/****************************************************************/
	
	$_MENU->set_root($root);
}

/**
 * Function used to sort menu items
 * @param BlgMenuItem $a
 * @param BlgMenuItem $b
 */
function blg_menu_sort(BlgMenuItem $a, BlgMenuItem $b) {	
    return ($a->priority - $b->priority);
}